<!DOCTYPE HTML>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>

    <!--    <link rel="shortcut icon" href="favicon.ico">-->
    <script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>

    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="/css/font-awesome.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row">
        <div class="col-sm-12">

            <div class="ibox">
                <div class="ibox-title">
                    <h5>药品管理</h5>
                    <div class="ibox-tools">
                        <a th:href="@{/constantitem/add}" class="btn btn-primary btn-xs">新增</a>
                    </div>
                </div>
                <div class="ibox-content">

                    <div class="project-list">

                        <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>常量类型</th>
                                <th>常数项编码</th>
                                <th>常数项名称</th>

                                <th width="15%">操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <tr th:each="const : ${consts}">
                                <td th:text="${constStat.index+1}"></td>

                                <td th:text="${const.ConstantType}"></td>
                                <td th:text="${const.ConstantCode}"></td>
                                <td th:text="${const.ConstantName}"></td>
                                <td>
                                    <a  class="btn btn-white btn-sm" th:href="@{/constantitem/edit/(id=${const.id})}">
                                        <i class="fa fa-pencil fa-fw"></i>修改
                                    </a>
                                    <a  class="btn btn-white btn-sm" th:href="@{/constantitem/del/(id=${const.id})}">
<!--                                    <a  class="btn btn-white btn-sm" th:onclick="delData([[${const.id}]])">-->
                                        <i class="fa fa-trash-o fa-fw"></i>删除
                                    </a>
                                </td>
                            </tr>
<!--                            <tr th:if="${pageNum == 0}">-->
<!--                                <td colspan="6">-->
<!--                                    暂无数据-->
<!--                                </td>-->
<!--                            </tr>-->

                        </tbody>

                        </table>
                </div>
<!--                    <nav th:if="${pageNum != 0}">-->
<!--                        <ul class="pagination">-->
<!--                            <li>-->
<!--                                <a th:if="${not isFirstPage}" th:href="@{/book/index(pageNum=${pageNum-1},pageSize=${pageSize})}" aria-label="Previous">-->
<!--                                    <span aria-hidden="true">&laquo;</span>-->
<!--                                </a>-->
<!--                                <a th:if="${isFirstPage}" href="javascript:void(0);" aria-label="Previous">-->
<!--                                    <span aria-hidden="true">&laquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->

<!--                            <li th:each="pageNo : ${#numbers.sequence(1, totalPages)}">-->
<!--                                <a th:if="${pageNum eq pageNo}" href="javascript:void(0);">-->
<!--                                    <span th:text="${pageNo}"></span>-->
<!--                                </a>-->

<!--                                <a th:if="${not (pageNum eq pageNo)}" th:href="@{/book/index(pageNum=${pageNo},pageSize=${pageSize})}">-->
<!--                                    <span th:text="${pageNo}"></span>-->
<!--                                </a>-->
<!--                            </li>-->

<!--                            <li>-->
<!--                                <a th:if="${not isLastPage}" th:href="@{/book/index(pageNum=${pageNum+1},pageSize=${pageSize})}" aria-label="Next">-->
<!--                                    <span aria-hidden="true">&raquo;</span>-->
<!--                                </a>-->
<!--                                <a th:if="${isLastPage}" href="javascript:void(0);" aria-label="Next">-->
<!--                                    <span aria-hidden="true">&raquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->
<!--                        </ul>-->
<!--                    </nav>-->
            </div>
        </div>
    </div>
</div>
</div>
<!-- Sweet alert -->
<script src="/js/plugins/sweetalert/sweetalert.min.js"></script>

<script type="text/javascript" th:inline="javascript">

    function delData(id) {

        swal({
                title: "警告",
                text: "是否删除该项吗！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确认",
                cancelButtonText: "取消",
                closeOnConfirm: false,
                closeOnCancel: false
            },
            function (isConfirm) {
                if (isConfirm) {
                    $.get("/const/del/" + id, function (res) {
                        if (res.succ) {
                            swal("成功！", res.msg, "success");
                        } else {
                            swal("失败！", res.msg, "error");
                        }
                    });

                } else {
                    swal("已取消", "取消删除", "error");
                }

                const url2 = [[@{/const/index}]];
                window.location.href = url2;
            });
    }
</script>

</body>
</html>
